package com.itheima.stock.Thread;

public class Join {
    public static void main(String[] args) throws InterruptedException {
        System.out.println("当前线程名 ： " + Thread.currentThread().getName());
        MyThread myThread = new MyThread();
        myThread.start();

        //public final void join() 插入线程
        //把m1线程插入到当前线程(main)之前
        myThread.join();

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + "正在干活:" + i);
        }

    }
    static class MyThread extends Thread {
        public void run()
        {
            for (int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName() + "正在枪活:" + i);
            }
        }
    }
}
